package com.sumainfor.pc.cfo.controller.provider;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.pc.cfo.service.impl.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Meng
 * @ClassName SearchController
 * @date 2019/8/5 16:10
 * @description: TODO 财务部搜索
 */
@RestController
@RequestMapping("/key/provider/cfo/search")
public class SearchController {

    @Autowired
    private SearchService service;

    /**
     * 财务部查询
     *
     * @param keyWord
     * @param roleId
     * @return
     */
    @PostMapping("/searchForCfo")
    public JsonResult searchForEpc(String keyWord, Integer roleId) {
        /**
         * 14	| 财务经理
         * 15	| 财务助理
         */
        JsonResult result;
        switch (roleId) {
            case 14:
            case 15:
                result = service.searchForCw(keyWord);
                break;
            default:
                result = JsonResult.error("没有这个类型的角色");
        }
        return result;
    }
}
